%% 画图函数
close all;
clear;
clc;

%% 读取文件
% [time; distance; altitude; velNorm; aThrusterNorm; mass; FThruster]
kr6 = importdata('kr6.csv');
kr9 = importdata('kr9.csv');
kr12 = importdata('kr12.csv');

%% 画图
% 横轴目标距离，纵轴高度
figure;
plot(kr6(2, :), kr6(3, :), 'linewidth', 1.5);
hold on;
plot(kr9(2, :), kr9(3, :), 'linewidth', 1.5);
plot(kr12(2, :), kr12(3, :), 'linewidth', 1.5);
xlabel('目标距离(m)');
ylabel('高度(m)');
% axis([-100, 4000, 3000, 5000]);
legend('kr = 6.0', 'kr = 9.0', 'kr = 12.0');

% 横轴时间，纵轴高度
figure;
plot(kr6(1, :), kr6(3, :), 'linewidth', 1.5);
hold on;
plot(kr9(1, :), kr9(3, :), 'linewidth', 1.5);
plot(kr12(1, :), kr12(3, :), 'linewidth', 1.5);
xlabel('时间(s)');
ylabel('高度(m)');
% axis([500, 650, 3000, 5000]);
legend('kr = 6.0', 'kr = 9.0', 'kr = 12.0');

% 横轴时间，纵轴速度
figure;
plot(kr6(1, :), kr6(4, :), 'linewidth', 1.5);
hold on;
plot(kr9(1, :), kr9(4, :), 'linewidth', 1.5);
plot(kr12(1, :), kr12(4, :), 'linewidth', 1.5);
xlabel('时间(s)');
ylabel('速度(m)');
% axis([400, 650, 0, 400]);
legend('kr = 6.0', 'kr = 9.0', 'kr = 12.0');

% 横轴时间，纵轴加速度
figure;
plot(kr6(1, 2:end), kr6(5, 2:end), 'linewidth', 1.5);
hold on;
plot(kr9(1, 2:end), kr9(5, 2:end), 'linewidth', 1.5);
plot(kr12(1, 2:end), kr12(5, 2:end), 'linewidth', 1.5);
xlabel('时间(s)');
ylabel('加速度(m/s^2)');
legend('kr = 6.0', 'kr = 9.0', 'kr = 12.0');

% 横轴时间，纵轴质量
figure;
plot(kr6(1, :), kr6(6, :), 'linewidth', 1.5);
hold on;
plot(kr9(1, :), kr9(6, :), 'linewidth', 1.5);
plot(kr12(1, :), kr12(6, :), 'linewidth', 1.5);
xlabel('时间(s)');
ylabel('着陆器质量(kg)');
axis([400, 650, 1400, 1800]);
legend('kr = 6.0', 'kr = 9.0', 'kr = 12.0');

% 横轴时间，纵轴推力
figure;
plot(kr6(1, 2:end), kr6(7, 2:end), 'linewidth', 1.5);
hold on;
plot(kr9(1, 2:end), kr9(7, 2:end), 'linewidth', 1.5);
plot(kr12(1, 2:end), kr12(7, 2:end), 'linewidth', 1.5);
xlabel('时间(s)');
ylabel('推力(N)');
legend('kr = 6.0', 'kr = 9.0', 'kr = 12.0');
